from django.db import models


class BlogBody(models.Model):
    blog_title = models.CharField('标题', max_length=50)
    blog_body = models.TextField('文章')
    blog_type = models.CharField('类型', max_length=10,
                                 choices=(('Python', '编程相关'), ('abouttest', '技术杂谈'), ('mytalk', '个人扯淡'),
                                          ('diary', '不知道起什么名字'),))
    blog_timestamp = models.DateTimeField('创建时间')
    blog_imgurl = models.CharField('图片地址', max_length=150, blank=True, null=True)
    blog_author = models.CharField('作者', max_length=20, null=True)
    blog_like = models.BooleanField('是否推荐', default=False)
    blog_clicknum = models.IntegerField('点击数', default=0)
    blog_abstract = models.CharField('首页简介',max_length=20)

    def __str__(self):
        return self.blog_title


class UserInfo(models.Model):
    nickname = models.CharField(max_length=20)
    work = models.CharField(max_length=20)
    company = models.CharField(max_length=50)
    email = models.CharField(max_length=20)

    def __str__(self):
        return self.nickname
